package com.yootk;
import java.util.concurrent.ThreadFactory;
class YootkThreadFactory implements ThreadFactory{
    private static final ThreadFactory INSTANCE=new YootkThreadFactory();
    private static final String TITLE="yootk-";
    private static int count=0;
    private YootkThreadFactory(){}
    public static ThreadFactory getInstance(){
        return INSTANCE;
    }
    @Override
    public Thread newThread(Runnable run){
        return new Thread(run,TITLE+count++);
    }
}
public class YootkDemo1 {
    public static void main(String[] args) throws Exception{
        Thread thread=YootkThreadFactory.getInstance().newThread(()->{
            System.out.println("多线程执行，"+Thread.currentThread().getName());
        });
        thread.start();
    }
}
